import os

try:
  from osgeo import ogr
except ImportError:
  print("Import of ogr from osgeo fialed!")


DRIVERNAME = "ESRI Shapefile"
file_path = "test.shp"
drv:ogr.Driver = ogr.GetDriverByName(DRIVERNAME)
if(os.path.exists(file_path)):
    drv.DeleteDataSource(file_path)
else:
    print("No such a file to delete, Please check the path of file!")